From: Without Boats Date: Wed, 4 Oct 2017 22:07:01 +0000 (-0700) Subject: Fix tests (to do with printing). X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~5^2~30^2~11 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=8a70ffb03bd76a3235145668d91e660d317d8ef8;p=cargo.git Fix tests (to do with printing). --- diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index 12fe51c44..4c88e8951 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -390,7 +390,7 @@ fn select_pkg<'a, T>(mut source: T, None => { let vers_info = vers.map(|v| format!(" with version `{}`", v)) .unwrap_or_default(); - Err(format!("could not find `{}` in `{}`{}", name, + Err(format!("could not find `{}` in {}{}", name, source.source_id(), vers_info).into()) } } diff --git a/src/cargo/sources/replaced.rs b/src/cargo/sources/replaced.rs index 5048f6186..883906146 100644 --- a/src/cargo/sources/replaced.rs +++ b/src/cargo/sources/replaced.rs @@ -29,7 +29,7 @@ impl<'cfg> Registry for ReplacedSource<'cfg> { self.inner.query(&dep, &mut |summary| { f(summary.map_source(replace_with, to_replace)) }).chain_err(|| { - format!("failed to query replaced source `{}`", + format!("failed to query replaced source {}", self.to_replace) }) } @@ -50,7 +50,7 @@ impl<'cfg> Source for ReplacedSource<'cfg> { fn update(&mut self) -> CargoResult<()> { self.inner.update().chain_err(|| { - format!("failed to update replaced source `{}`", + format!("failed to update replaced source {}", self.to_replace) }) } @@ -58,7 +58,7 @@ impl<'cfg> Source for ReplacedSource<'cfg> { fn download(&mut self, id: &PackageId) -> CargoResult { let id = id.with_source_id(&self.replace_with); let pkg = self.inner.download(&id).chain_err(|| { - format!("failed to download replaced source `{}`", + format!("failed to download replaced source {}", self.to_replace) })?; Ok(pkg.map_source(&self.replace_with, &self.to_replace)) diff --git a/tests/install.rs b/tests/install.rs index 3ed4bf0d9..9e59f4c0a 100644 --- a/tests/install.rs +++ b/tests/install.rs @@ -62,17 +62,17 @@ fn multiple_pkgs() { assert_that(cargo_process("install").args(&["foo", "bar", "baz"]), execs().with_status(101).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] foo v0.0.1 (registry file://[..]) +[DOWNLOADING] foo v0.0.1 (registry `file://[..]`) [INSTALLING] foo v0.0.1 [COMPILING] foo v0.0.1 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] {home}[..]bin[..]foo[..] -[DOWNLOADING] bar v0.0.2 (registry file://[..]) +[DOWNLOADING] bar v0.0.2 (registry `file://[..]`) [INSTALLING] bar v0.0.2 [COMPILING] bar v0.0.2 [FINISHED] release [optimized] target(s) in [..] [INSTALLING] {home}[..]bin[..]bar[..] -error: could not find `baz` in `registry [..]` +error: could not find `baz` in registry `[..]` Summary: Successfully installed foo, bar! Failed to install baz (see error(s) above). warning: be sure to add `[..]` to your PATH to be able to run the installed binaries @@ -121,7 +121,7 @@ fn missing() { assert_that(cargo_process("install").arg("bar"), execs().with_status(101).with_stderr("\ [UPDATING] registry [..] -[ERROR] could not find `bar` in `registry [..]` +[ERROR] could not find `bar` in registry `[..]` ")); } @@ -131,7 +131,7 @@ fn bad_version() { assert_that(cargo_process("install").arg("foo").arg("--vers=0.2.0"), execs().with_status(101).with_stderr("\ [UPDATING] registry [..] -[ERROR] could not find `foo` in `registry [..]` with version `=0.2.0` +[ERROR] could not find `foo` in registry `[..]` with version `=0.2.0` ")); } diff --git a/tests/local-registry.rs b/tests/local-registry.rs index 7643a92aa..227289334 100644 --- a/tests/local-registry.rs +++ b/tests/local-registry.rs @@ -287,10 +287,10 @@ fn invalid_dir_bad() { [ERROR] failed to load source for a dependency on `foo` Caused by: - Unable to update registry https://[..] + Unable to update registry `https://[..]` Caused by: - failed to update replaced source `registry https://[..]` + failed to update replaced source registry `https://[..]` Caused by: local registry path is not a directory: [..]path[..]to[..]nowhere diff --git a/tests/registry.rs b/tests/registry.rs index c63310e64..33677bdb5 100644 --- a/tests/registry.rs +++ b/tests/registry.rs @@ -38,7 +38,7 @@ fn simple() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `{reg}` -[DOWNLOADING] bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry `file://[..]`) [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -78,8 +78,8 @@ fn deps() { assert_that(p.cargo_process("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `{reg}` -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) [COMPILING] baz v0.0.1 [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) @@ -175,10 +175,10 @@ fn bad_cksum() { [ERROR] unable to get packages from source Caused by: - failed to download replaced source `registry https://[..]` + failed to download replaced source registry `https://[..]` Caused by: - failed to verify the checksum of `bad-cksum v0.0.1 (registry file://[..])` + failed to verify the checksum of `bad-cksum v0.0.1 (registry `file://[..]`)` ")); } @@ -210,7 +210,7 @@ version required: >= 0.0.0 assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `{reg}` -[DOWNLOADING] notyet v0.0.1 (registry file://[..]) +[DOWNLOADING] notyet v0.0.1 (registry `file://[..]`) [COMPILING] notyet v0.0.1 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -264,7 +264,7 @@ version required: ^0.0.1 [PACKAGING] foo v0.0.1 ({dir}) [VERIFYING] foo v0.0.1 ({dir}) [UPDATING] registry `[..]` -[DOWNLOADING] notyet v0.0.1 (registry file://[..]) +[DOWNLOADING] notyet v0.0.1 (registry `file://[..]`) [COMPILING] notyet v0.0.1 [COMPILING] foo v0.0.1 ({dir}[..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -291,7 +291,7 @@ fn lockfile_locks() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry `file://[..]`) [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -326,8 +326,8 @@ fn lockfile_locks_transitively() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) [COMPILING] baz v0.0.1 [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) @@ -366,8 +366,8 @@ fn yanks_are_not_used() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) [COMPILING] baz v0.0.1 [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) @@ -462,7 +462,7 @@ fn update_with_lockfile_if_packages_missing() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr("\ [UPDATING] registry `[..]` -[DOWNLOADING] bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry `file://[..]`) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs ")); } @@ -501,7 +501,7 @@ fn update_lockfile() { println!("0.0.2 build"); assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ -[DOWNLOADING] [..] v0.0.2 (registry file://[..]) +[DOWNLOADING] [..] v0.0.2 (registry `file://[..]`) [COMPILING] bar v0.0.2 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -519,7 +519,7 @@ fn update_lockfile() { println!("0.0.3 build"); assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ -[DOWNLOADING] [..] v0.0.3 (registry file://[..]) +[DOWNLOADING] [..] v0.0.3 (registry `file://[..]`) [COMPILING] bar v0.0.3 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -569,7 +569,7 @@ fn dev_dependency_not_used() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry `file://[..]`) [COMPILING] bar v0.0.1 [COMPILING] foo v0.0.1 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -652,7 +652,7 @@ fn updating_a_dep() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry `file://[..]`) [COMPILING] bar v0.0.1 [COMPILING] a v0.0.1 ({dir}/a) [COMPILING] foo v0.0.1 ({dir}) @@ -675,7 +675,7 @@ fn updating_a_dep() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] registry `[..]` -[DOWNLOADING] bar v0.1.0 (registry file://[..]) +[DOWNLOADING] bar v0.1.0 (registry `file://[..]`) [COMPILING] bar v0.1.0 [COMPILING] a v0.0.1 ({dir}/a) [COMPILING] foo v0.0.1 ({dir}) @@ -721,7 +721,7 @@ fn git_and_registry_dep() { execs().with_status(0).with_stderr(&format!("\ [UPDATING] [..] [UPDATING] [..] -[DOWNLOADING] a v0.0.1 (registry file://[..]) +[DOWNLOADING] a v0.0.1 (registry `file://[..]`) [COMPILING] a v0.0.1 [COMPILING] b v0.0.1 ([..]) [COMPILING] foo v0.0.1 ({dir}) @@ -787,7 +787,7 @@ fn update_publish_then_update() { assert_that(p.cargo("build"), execs().with_status(0).with_stderr(&format!("\ [UPDATING] [..] -[DOWNLOADING] a v0.1.1 (registry file://[..]) +[DOWNLOADING] a v0.1.1 (registry `file://[..]`) [COMPILING] a v0.1.1 [COMPILING] foo v0.5.0 ({dir}) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] secs @@ -854,7 +854,7 @@ fn update_transitive_dependency() { assert_that(p.cargo("build"), execs().with_status(0) .with_stderr("\ -[DOWNLOADING] b v0.1.1 (registry file://[..]) +[DOWNLOADING] b v0.1.1 (registry `file://[..]`) [COMPILING] b v0.1.1 [COMPILING] a v0.1.0 [COMPILING] foo v0.5.0 ([..]) @@ -945,11 +945,11 @@ fn update_multiple_packages() { assert_that(p.cargo("build"), execs().with_status(0) .with_stderr_contains("\ -[DOWNLOADING] a v0.1.1 (registry file://[..])") +[DOWNLOADING] a v0.1.1 (registry `file://[..]`)") .with_stderr_contains("\ -[DOWNLOADING] b v0.1.1 (registry file://[..])") +[DOWNLOADING] b v0.1.1 (registry `file://[..]`)") .with_stderr_contains("\ -[DOWNLOADING] c v0.1.1 (registry file://[..])") +[DOWNLOADING] c v0.1.1 (registry `file://[..]`)") .with_stderr_contains("\ [COMPILING] a v0.1.1") .with_stderr_contains("\ diff --git a/tests/resolve.rs b/tests/resolve.rs index 2b84106a6..31f7abaa6 100644 --- a/tests/resolve.rs +++ b/tests/resolve.rs @@ -376,7 +376,7 @@ fn resolving_but_no_exists() { assert_eq!(res.err().unwrap().to_string(), "\ no matching package named `foo` found (required by `root`) -location searched: registry http://example.com/ +location searched: registry `http://example.com/` version required: ^1\ "); }